<template>
	<view class="teamuser">
		<u-navbar title="团队成员" bgColor="#fff" :autoBack="true">
		</u-navbar>
		<view class="addCustomer flex_shu" @tap="addTeam">
			<image :src="imgUrl + 'addTeam.png'" mode="" class="addImg"></image>
			<text>项目分配</text>
		</view>
		<scroll-view class="shopUl" :class="classifyIndex==-1?'uiheight':'uiheightTwo'" scroll-y="true" lower-threshold="50"
			@scrolltolower="classifyLower">
			<view class="customerBox" v-for="(item,index) in allShopList" :key="index" @click="teamUserClick(item)">
				<view class="rightTop">
					查看详情
				</view>
				<view class="customerItembox flex_heng">
					<u-avatar :src="imgUrl + 'goods.png'" shape="circle" size="34"></u-avatar>
					<view class="flex_shu" style="align-items: flex-start;margin-left: 12rpx;">
						<view class="itemName">
							<text class="u-line-1">{{item.name}}</text>
						</view>
						<view class="itemCon flex_heng">
							<view class="itemPhone">
								{{item.phone}}
							</view>
						</view>
					</view>
				</view>
			</view>
		</scroll-view>
	</view>
</template>

<script>
	import {
		getTeamList
	} from "@/api/api.js"
	export default {
		data() {
			return {
				imgUrl: this.$imgUrl,
				allShopList: [{
						status: 1,
						time: '2042/07/01 00:23',
						name: '客户姓名',
						phone: '15929238080',
						type: 1,
						id: '1'
					},
					{
						status: 2,
						time: '2042/07/01 00:23',
						name: '客户姓名',
						phone: '15929238080',
						type: 2
					}, {
						status: 2,
						time: '2042/07/01 00:23',
						name: '客户姓名',
						phone: '15929238080',
						type: 3
					}, {
						status: 2,
						time: '2042/07/01 00:23',
						name: '客户姓名',
						phone: '15929238080',
						type: 1
					}, {
						status: 3,
						time: '2042/07/01 00:23',
						name: '客户姓名',
						phone: '15929238080',
						type: 1
					},
				],
				pageNum: 1,
			};
		},
		onLoad(options) {},
		onShow() {
			this.pageNum = 1;
			this.allShopList = [];
			this.getTeamList();
		},
		onReachBottom() {
			this.pageNum++;
			this.getTeamList()
		},
		methods: {

			getTeamList() {
				getTeamList({
					pageNum: this.pageNum,
					pageSize: 30,
					appUserId: uni.getStorageSync('userInfo').id,
					// dadAppUserId
				}).then(res => {
					if (res.rows.length > 0) {
						this.allShopList = [...this.allShopList, ...res.rows]
					}
				})
			},

			//客户点击
			teamUserClick(item) {
				uni.navigateTo({
					url: `/pages/package/teamUserInfo/teamUserInfo?teamUserId=${item.id}`
				})
			},
			//分类列表到底
			classifyLower() {
				console.log('分类列表到底')
			},


			addTeam() {
				uni.navigateTo({
					url: `/pages/package/teamUserInfo/teamUserInfo`
				})
			},

		},
	}
</script>

<style lang="scss">
	.teamuser {
		min-height: 100vh;
		padding: 200rpx 28rpx 0;
		box-sizing: border-box;
		background-color: #F6F6F6;

		.addCustomer {
			width: 100%;
			height: 136rpx;

			.addImg {
				width: 84rpx;
				height: 84rpx;
			}

			text {
				color: #000000;
				font-size: 28rpx;
				font-weight: 400;
			}
		}

		.shopUl {
			width: 100%;

			.customerBox {
				width: 100%;
				height: 138rpx;
				position: relative;

				.rightTop {
					position: absolute;
					right: 28rpx;
					top: 50%;
					transform: translateY(-50%);
					width: 152rpx;
					height: 66rpx;
					border-radius: 36rpx;
					line-height: 66rpx;
					opacity: 1;
					background: linear-gradient(-49.9deg, #00bf39 0%, #34dfa3 100%);
					opacity: 1;
					color: #ffffff;
					text-align: center;
					font-size: 28rpx;
					font-weight: 500;
				}

				.customerItembox {
					margin-top: 28rpx;
					width: 100%;
					height: 138rpx;
					border-radius: 36rpx;
					opacity: 1;
					background: #ffffff;
					padding: 28rpx;
					box-sizing: border-box;
					justify-content: flex-start;

					.itemName {
						color: #000000;
						font-size: 28rpx;
						font-weight: 500;
					}

					.itemCon {
						width: 100%;
						align-items: center;
						justify-content: flex-start;
						color: #333333;
						font-size: 24rpx;
						font-weight: 400;

						.itemPhone {
							width: 40%;
						}

					}

				}

			}
		}
	}
</style>